package com.oo.array_$.case_1;

import java.util.Scanner;

/**
 * GuessDate--从键盘输入一个整数，然后判断数组中是否含有该数，如果存在，输出
 “猜对了!”，否则输出“Sorry!”
 *
 * @author: Jovi
 * @createTime: 2017-05-11 13:43
 **/
public class GuessDate {

    public static void main(String[] args) {
        int[] list = {5, 42, 11, 33, 62, 982};
        Scanner sc = new Scanner(System.in);
        System.out.println("Please enter a integer：");
        int guess = sc.nextInt();
        boolean isCorretct = false;
        for (int i = 0; i < list.length; i++) {
            if (guess == list[i]) {
                isCorretct = true;
                break;
            }
        }

        if (isCorretct) {
            System.out.println("guess right");
        } else {
            System.out.println("guess wrong");
        }
    }
}
